package com.weimei.conversionTreasure.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gtdev5.geetolsdk.mylibrary.beans.Gds;
import com.weimei.conversionTreasure.R;

public class VipAdapter extends BaseQuickAdapter<Gds, BaseViewHolder> {
    public VipAdapter() {
        super(R.layout.vip_item);
    }

    int mIndex = 0;
    public void setSel(int index){
        mIndex = index;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, Gds gds) {
        holder.setText(R.id.vip_name,gds.getName());
        holder.setText(R.id.vip_price,gds.getPrice());
        holder.setText(R.id.vip_yj,"原价"+gds.getOriginal());

        if (mIndex == getItemPosition(gds)){
            holder.setTextColor(R.id.vip_name, Color.parseColor("#3454FF"));
            holder.setTextColor(R.id.vip_price, Color.parseColor("#3454FF"));
            holder.setTextColor(R.id.rmb, Color.parseColor("#3454FF"));

            holder.setVisible(R.id.vip_hot, true);
            holder.setBackgroundResource(R.id.item,R.drawable.frame_vip_sel_8);
        }else {
            holder.setTextColor(R.id.vip_name, Color.parseColor("#5A5D68"));
            holder.setTextColor(R.id.vip_price, Color.parseColor("#5A5D68"));
            holder.setTextColor(R.id.rmb, Color.parseColor("#5A5D68"));

            holder.setGone(R.id.vip_hot, true);
            holder.setBackgroundResource(R.id.item,R.drawable.frame_ef_8);


        }



    }
}
